home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / Window.data < prev    next >
Text File  |  1995-08-19  |  4KB  |  181 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. Window = {
  5.  
  6.     SHORT = {{ Show info about the Shell Window }};
  7.  
  8.     DESCRIPTION = {{
  9.     Window asks Console: for its WindowPtr and shows some
  10.     Information about the current shell window.
  11.     }};
  12.  
  13.     NOTES = {{
  14.     Usage of this command blocks "Auto" abilities of Console windows
  15.     and stops Iconify possibilities with KingCON windows.
  16.     }};
  17.  
  18.     HISTORY = {{
  19.     29-Apr-95 b_noll created
  20.     19-08-95 b_noll created .data file
  21.     }};
  22.  
  23.     includes = {
  24.     "<exec/memory.h>",
  25.     "<strings.h>",
  26.     "<intuition/intuition.h>"
  27.     };
  28.  
  29.     Template = "TITLE/S,TOP/S,LEFT/S,WIDTH/S,HEIGHT/S,SET/S,ENV=SETENV/S,SAVE=ENVARC/S,ONEVAR/K";
  30.     Arguments = {{
  31.  
  32.     ULONG  TITLE;
  33.     ULONG  TOP;
  34.     ULONG  LEFT;
  35.     ULONG  WIDTH;
  36.     ULONG  HEIGHT;
  37.     ULONG  SET;
  38.     ULONG  ENV;
  39.     ULONG  SAVE;
  40.     STRPTR ONEVAR;
  41.     }};
  42.  
  43.     version = "1.0";
  44.  
  45.     body = {{
  46.     BPTR console;
  47.     int i,j,k;
  48.     ULONG flags = 0;
  49.  
  50.     /* examine what */
  51.     for (i = j = 0; i < 5; i++)
  52.         if (((ULONG *)argv)[i])
  53.         ++j;
  54.  
  55.     /* write where */
  56.     if (argv->SET)
  57.         flags |= GVF_LOCAL_ONLY;
  58.     if (argv->ENV)
  59.         flags |= GVF_GLOBAL_ONLY;
  60.     if (argv->SAVE)
  61.         flags |= GVF_SAVE_VAR;
  62.  
  63.  
  64. #   if RAW_INFO
  65.     UBYTE buffer[256];
  66.     console = Open("CONSOLE:", MODE_READWRITE);
  67.     oldmode = SetMode (console,1);
  68.     Write  (console,aWSR,strlen(aWSR));
  69.     Flush  (console)
  70.     Read   (console,buffer, sizeof buffer);
  71.     SetMode(console,oldmode);
  72.     Close  (console);
  73. #   else
  74.     if (console = Open("CONSOLE:", MODE_OLDFILE)) {
  75.         struct InfoData *id;
  76.         if (id = AllocVec(sizeof *id, MEMF_CLEAR|MEMF_PUBLIC))
  77.         //if (id = AllocDosObject(DOS_INFO,NULL))
  78.         //           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Not Yet supported
  79.         {
  80.         BPTR           lock;
  81.         struct Window *win = NULL;
  82. #   if 0
  83.         if (lock = DupLockFromFH(console)) {
  84.             if (Info (lock,id))
  85.             win = id->id_VolumeNode;
  86.             UnLock(lock);
  87.         } /* if */
  88. #   else
  89.         if (DoPkt(((struct FileHandle *)BADDR(console))->fh_Type, ACTION_DISK_INFO, MKBADDR(id),0,0,0,0))
  90.             win = id->id_VolumeNode;
  91. #   endif
  92.  
  93.         if (win)
  94.         if (!flags) {
  95.             if (!j || argv->TITLE) {
  96.             Printf ("Set NAME=\"%s\"\t\"%s\"\n", "TITLE", win->Title);
  97.             } /* if */
  98.             if (!j || argv->LEFT) {
  99.             Printf ("Set NAME=\"%s\"\t%ld\n", "LEFT", win->LeftEdge);
  100.             } /* if */
  101.             if (!j || argv->TOP) {
  102.             Printf ("Set NAME=\"%s\"\t%ld\n", "TOP", win->TopEdge);
  103.             } /* if */
  104.             if (!j || argv->WIDTH) {
  105.             Printf ("Set NAME=\"%s\"\t%ld\n", "WIDTH", win->Width);
  106.             } /* if */
  107.             if (!j || argv->HEIGHT) {
  108.             Printf ("Set NAME=\"%s\"\t%ld\n", "HEIGHT", win->Height);
  109.             } /* if */
  110.         } else if (!argv->ONEVAR) {
  111.             UBYTE buffer[MAXLINELEN];
  112.             if (!j || argv->TITLE) {
  113.             SPrintf(buffer, "%s", win->Title);
  114.             SetVar ("TITLE", buffer, -1, flags);
  115.             } /* if */
  116.             if (!j || argv->LEFT) {
  117.             SPrintf(buffer, "%ld", win->LeftEdge);
  118.             SetVar ("LEFT", buffer, -1, flags);
  119.             } /* if */
  120.             if (!j || argv->TOP) {
  121.             SPrintf(buffer, "%ld", win->TopEdge);
  122.             SetVar ("TOP", buffer, -1, flags);
  123.             } /* if */
  124.             if (!j || argv->WIDTH) {
  125.             SPrintf(buffer, "%ld", win->Width);
  126.             SetVar ("WIDTH", buffer, -1, flags);
  127.             } /* if */
  128.             if (!j || argv->HEIGHT) {
  129.             SPrintf(buffer, "%ld", win->Height);
  130.             SetVar ("HEIGHT", buffer, -1, flags);
  131.             } /* if */
  132.         } else {
  133.             UBYTE buffer[MAXLINELEN];
  134.             UBYTE lbuffer[MAXLINELEN];
  135.             if (!j || argv->TITLE) {
  136.             SPrintf(buffer, "%s", win->Title);
  137.             strcat (lbuffer, buffer);
  138.             } /* if */
  139.             if (!j || argv->LEFT) {
  140.             SPrintf(buffer, "%ld", win->LeftEdge);
  141.             strcat (lbuffer, buffer);
  142.             } /* if */
  143.             if (!j || argv->TOP) {
  144.             SPrintf(buffer, "%ld", win->TopEdge);
  145.             strcat (lbuffer, buffer);
  146.             } /* if */
  147.             if (!j || argv->WIDTH) {
  148.             SPrintf(buffer, "%ld", win->Width);
  149.             strcat (lbuffer, buffer);
  150.             } /* if */
  151.             if (!j || argv->HEIGHT) {
  152.             SPrintf(buffer, "%ld", win->Height);
  153.             strcat (lbuffer, buffer);
  154.             } /* if */
  155.             SetVar (argv->ONEVAR, lbuffer, -1, flags);
  156.         } /* if */
  157.  
  158.         FreeVec(id);
  159.         //FreeDosObject (DOS_INFO, id);
  160.         //^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Not Yet supported
  161.         } /* if */
  162.         Close (console);
  163.     } /* if */
  164. #   endif
  165.  
  166.     }};
  167.  
  168.     Addes = {{
  169.     __inline void SPrintf (STRPTR str, const STRPTR fmt, ...)
  170.     {
  171. #    undef SysBase
  172.     struct ExecBase *SysBase = *(struct ExecBase **)ABSEXECBASE;
  173.     RawDoFmt (fmt, &(fmt) + 1, (APTR)"\0x16\0xC0\0x4E\0x75", str);
  174.     } /* SPrintf */
  175.     }};
  176.  
  177. };
  178.  
  179. #endif
  180.  
  181.